﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 组合模式
{
    //图形抽象类
    public abstract class Graphics
    {
        public string Name { get; set; }
        public Graphics(string name)
        {
            this.Name = name;
        }
        public abstract void Draw();
    }

    //简单图形类——线
    class Line : Graphics
    {
        public Line(string na)
            : base(na)
        { }
        public override void Draw()
        {
            Console.WriteLine("画 " + Name);
        }
    }
    //简单图形类——圆
    class Circle : Graphics
    {
        public Circle(string nam) : base(nam)
        { }
        public override void Draw()
        {
            Console.WriteLine("画 " + base.Name);
        }
    }

}
